package com.czxy.controller;

import com.czxy.domain.Product;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

@Controller
public class HelloController {

    @RequestMapping("/show.action")
    public String show(Model model){

        System.out.println("HelloController 中 的 show 接收到了请求 ");

        String s = "jojo";

        model.addAttribute("data",s);



        return "/show.jsp";

    }
    @RequestMapping("/showList.action")
    public  String showList(Model model){
        List<Product> list =  new ArrayList<>();

        list.add(new Product("联想笔记本", 6999.3, "ThinkPad T430 联想笔记本电脑！"));
        list.add(new Product("苹果手机", 50.0, "iphone X 苹果手机！"));

        model.addAttribute("list",list);


        return "/showList.jsp";

    }


}
